<?php

/**

 * aheadWorks Co.

 *

 * NOTICE OF LICENSE

 *

 * This source file is subject to the EULA

 * that is bundled with this package in the file LICENSE.txt.

 * It is also available through the world-wide-web at this URL:

 * http://ecommerce.aheadworks.com/LICENSE-M1.txt

 *

 * @category   AW

 * @package    AW_Mobile

 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)

 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt

 */

?>

<?php

/**

 * Product list template

 *

 * @see Mage_Catalog_Block_Product_List

 */

?>

<?php $_productCollection=$this->getLoadedProductCollection() ?>

<?php if(!$_productCollection->count()): ?>

<div class="note-msg">

    <?php echo $this->__('There are no products matching the selection.') ?>

</div>

<?php else: ?>

<?php echo $this->getChildHtml('toplistnav') ?>

<?php // List mode ?>

<?php $_iterator = 0; ?>

<div class="listing-type-list catalog-listing">

<ul class="c-list" id="c-list">

<?php foreach ($_productCollection as $_product): ?>

    <li>

        <div class="col2-alt-set" onclick="document.location = '<?php echo $_product->getProductUrl() ?>'; return false;">

            <div class="col-1">

                <?php // Product Image ?>

                <div class="product-image">

					<?php

						if(array_key_exists("feature" , $_product->getAttributes())){

							$featured = $_product->getResource()->getAttribute('feature')->getFrontend()->getValue($_product);

						if($featured=='sale') {

							echo '<div class="p-sale"></div>';

						}elseif($featured=='hot') {

							echo '<div class="p-hot"></div>';

						}elseif($featured=='new') {

							echo '<div class="p-new"></div>';

						}elseif($featured=='75%off') {

							echo '<div class="p-75off"></div>';

						}}

					?>

                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(138, 138); ?>" width="138" height="138" alt="<?php echo $this->helper('awmobile')->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" title="<?php echo $this->helper('awmobile')->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

                </div>

            </div>

            <div class="col-2 aranged">

                <?php // Product description ?>

                <div class="product-shop">

                    <?php $simplePricesTax = ($this->helper('tax')->displayPriceIncludingTax() || $this->helper('tax')->displayBothPrices()); ?>

                    <?php $_minimalPriceValue = $_product->getMinimalPrice() ?>

                    <?php $_minimalPrice = $this->helper('tax')->getPrice($_product, $_minimalPriceValue, $simplePricesTax) ?>

                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->helper('awmobile')->stripTags($_product->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName(), 'name') ?></a>

                    <?php

                    if ($_product->getTypeId() == 'bundle'){

                        list($_minimalPrice, $_maximalPrice) = $_product->getPriceModel()->getPrices($_product);

                        $_price = $_minimalPrice;

                    } elseif ($_product->getTypeId() == 'grouped') {     

                        $_exclTax = $this->helper('tax')->getPrice($_product, $_minimalPriceValue, $includingTax = null);

                        $_inclTax = $this->helper('tax')->getPrice($_product, $_minimalPriceValue, $includingTax = true);                        

                        $_price = $_inclTax;

                        if (!$this->helper('tax')->displayPriceIncludingTax()) {

                            $_price = $_exclTax;

                        }                        

                    } else {

						$_regularPrice = $_product->getPrice();

                        $_price = $_product->getFinalPrice();

                    } ?>

					<div class="price-block">

						<?php if($_regularPrice!=$_price): ?>

						<span class="product-regular-price"><?php echo Mage::app()->getStore()->convertPrice( $_regularPrice, true ); ?></span>

						<?php endif; ?>

						<span class="product-price"><?php echo Mage::app()->getStore()->convertPrice( $_price, true ); ?></span>

					</div>

					

					<?php

						$this->addReviewSummaryTemplate('list_short','review/helper/summary_list_short.phtml');

						echo $this->getReviewsSummaryHtml($_product, 'list_short', true)

					?>

					

					<div style="margin:10px 0 10px;">

						<?php

							$weight2 = $_product->getResource()->getAttribute('weight2')->getFrontend()->getValue($_product);

							$quantity1 = $_product->getResource()->getAttribute('quantity1')->getFrontend()->getValue($_product);

			

							if($weight2!='No')

								echo '<span class="tag-red">'.$weight2.'</span>';

							if($quantity1!='No')

								echo '<span class="tag-green">'.$quantity1.'</span>';

						?>

						

						<?php

							$weight1 = $_product->getResource()->getAttribute('weight1')->getFrontend()->getValue($_product);

							$quantity = $_product->getResource()->getAttribute('quantity')->getFrontend()->getValue($_product);

			

							if($weight1!='No')

								echo '<span class="tag-red">'.$weight1.'</span>';

							if($quantity!='No')

								echo '<span class="tag-green">'.$quantity.'</span>';

						?>

						

					</div>

					

					<?php

						$shipping_time="";

						if(array_key_exists("shipping_time" , $_product->getAttributes())){

							$shipping_time = $_product->getResource()->getAttribute('shipping_time')->getFrontend()->getValue($_product);

						}

					?>

					<?php if($shipping_time==$this->__('Yes')): ?>

					 <div class="shipping_time"></div>

					<?php endif; ?>

                </div>

            </div>

            <div class="clear"></div>

    </div>

</li>

<?php endforeach; ?>

</ul>

<script type="text/javascript">

    decorateList('c-list', 'none-recursive');

    

    /* Redrawing of catalog list */

    var redrawList = function(){

        $j('ul.c-list div.description').each(function(index, element){

            var targetNode = $j(element.parentNode);

            var screenW = $j(element.parentNode.parentNode).width();

            var firstChildWidth = $j(element.parentNode.parentNode.select('.col-1')[0]).width();

            targetNode.width(screenW - firstChildWidth);

        });        

    };

    redrawList();

    $j(document).ready(function(){

        $j(document).bind('checkorientationchange', function(){

            redrawList();

        });

    });

    

</script>

</div>



<?php echo $this->getToolbarHtml() ?>

<?php endif; ?>

